package org.abacus.json.v10;

import org.junit.Test;

public class LongKeyValue extends KeyValue<Long> {

	@Override
	public Long getValue() {
		if (null == value) {
			if (null == this.getStrValue()) {
				value = null;
			} else if ("null".equalsIgnoreCase(this.getStrValue())) {
				value = null;
			} else if ("\"null\"".equalsIgnoreCase(this.getStrValue())) {
				value = null;
			} else if (this.getStrValue().startsWith(QUOTES) && this.getStrValue().endsWith(QUOTES)) {
				value = Long.valueOf(this.getStrValue().substring(1, this.getStrValue().length() - 1));
			} else {
				value = Long.valueOf(this.getStrValue());
			}
		}
		return value;
	}

	@Override
	public void setValue(Long value) {
		this.value = value;
	}

	@Test
	public void test() {
		LongKeyValue longKeyValue = new LongKeyValue();

		longKeyValue.setStrValue("\"1\"");
		longKeyValue.getValue();
	}
}
